<template>
	<view class="page">
		<view class="btn" @tap="toTop" v-if="isTop">
			<text class="iconfont">&#xe60e;</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "backTop",
		props: {
			isTop: {
				type: Boolean,
				default: false
			}
		},
		methods: {
			toTop() {
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				})
			}
		}
	}
</script>

<style lang="scss">
	.btn {
		width: 40px;
		height: 40px;
		line-height: 40px;
		text-align: center;
		background-color: #d0d0d096;
		border-radius: 4px;
		position: fixed;
		right: 16px;
		bottom: 100px;
		z-index: 999;

		.iconfont {
			color: #fff;
			font-size: 32px;
		}
	}
</style>